<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>百顺通云-购物车</title>
<link rel="shortcut icon" href="/images/user/favicon.png" type="image/x-icon">
<link href="/css/user/buy/css.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="/css/dialog.css" />
<script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src = "/js/dialog.min.js"></script>
<script type="text/javascript" src = "/js/bstdialog.min.js"></script>
<script type="text/javascript" src="/js/member-center.js"></script>
<script type="text/javascript" src="/js/user/buy/shoppingCart.js"></script>
<script type="text/javascript" src="/js/mineDateCalculate.js"></script>
<script type="text/javascript" src="/js/minePriceCalculate.js"></script>
<script type="text/javascript" src="/js/ajaxDataFormat.js"></script>

<style type="text/css">
    	.dialog_success .aui_close, .dialog_confirm .aui_close, .dialog_ .aui_close, .dialog_warn .aui_close, .dialog_prohibit .aui_close
    	{display:block;}
    	.aui_titleBar .aui_title {
			font-size: 20px;
			padding: 10px 20px;
			 border-bottom: none; 
			}
    	
    </style>
    
</head>

<body onload ="javascript:countAll()">
<div class="Wrapper">
	<input type="hidden" name="isValid" id="isValid" value="${supplierInfo.isValid}"/>
	<input type="hidden" name="mealPrivilege" id="mealPrivilege" value="${supplierInfo.mealPrivilege}"/>
	<input type="hidden" name="proPrivilege" id="proPrivilege" value="${supplierInfo.proPrivilege}"/>
	<input type="hidden" id="requestURI" value="${requestURI}"/>
	<input type="hidden" name="loginUserRoleId" id="loginUserRoleId" value="${userInfo.roleId}">
	<input type="hidden" name="pageNum" id="pageNum" value="2">
		                            	
	<!--购物车头部-->
	<jsp:include page="../common/buy/buy_header.jsp"></jsp:include>
	<!--购物车头部-->
	
    <!--会员中心中间部分-->
    <div class="uc_bd mt20 mb20 ">
    	<div class="uc_layer">
        	<!--购物车步骤开始-->
            <div class="account">
                <div class="logo fl"><img src="/images/user/buy/logo2.png" width="152" height="60" /></div>
                <div class="process cart fr"></div>
                <div class="process orders fr" style="display:none"></div>
                <div class="process submit fr" style="display:none"></div>
                <div class="process success fr" style="display:none"></div>
                <div class="clear"></div>
			</div>
            <!--购物车步骤结束-->
            <!--购物车开始-->
			<div class="account shopping mt20">
            	<h2>购物车</h2>
                <div class="uitopb uitopb_border">
                	<table class="cart-table" id="shoppingCartTable">
			            <thead class="tabs cle">
			           		<tr>
				            	<th class="qx">
					            	<input type="checkbox" name="checkboxAll" class="checkboxAll"/>
					                <label for="checkbox">全选</label>
				              	</th>
								<th>产品名称</th>
								<th>年限</th>
								<th>用户数</th>
								<th>价格（元）</th>
								<th>优惠</th>
								<th>数量</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody class="item_content">
							<c:if test="${scList.size() == 0}">
								<tr><td colspan="8">暂无数据，请添加过商品后再查看！</td></tr>
							</c:if>
							<c:if test="${scList.size() != 0}">
								<c:forEach items="${scList}" var="sc" varStatus="status">
								
								<tr id="sc${sc.shoppingCartId}">							
	               					<td class="td td_chk">
		                            	<div class="cart_checkbox">
		                                    <input type="checkbox" name="checkbox" id="checkbox" onclick="javascript:cancleOther()" />
		                                    <label for="checkbox">勾选</label>
		                            	</div>
		                            </td>
		                            <td style="width: 160px;">
		                            	<font id="proMealName${sc.shoppingCartId}" >${sc.goodsName}</font>
		                            	<input type="hidden" name="shoppingCartId" id="shoppingCartId${sc.shoppingCartId}" value="${sc.shoppingCartId}">
		                            	<input type="hidden" name="proMealId" id="proMealId${sc.shoppingCartId}" value="${sc.proMealId}">
		                            	<input type="hidden" name="relationId" id="relationId${sc.shoppingCartId}" value="${sc.relationId}">
		                            	<input type="hidden" name="usersMin" id="usersMin${sc.shoppingCartId}" value="${sc.usersMin}">
		                            	<input type="hidden" name="usersMax" id="usersMax${sc.shoppingCartId}" value="${sc.usersMax}">
		                            	<input type="hidden" name="yearsMin" id="yearsMin${sc.shoppingCartId}" value="${sc.yearsMin}">
		                            	<input type="hidden" name="yearsMax" id="yearsMax${sc.shoppingCartId}" value="${sc.yearsMax}">
		                            	<input type="hidden" name="goodsPrice" id="goodsPrice${sc.shoppingCartId}" value="${sc.goodsPrice}">
		                            	<input type="hidden" name="localUseYear" id="localUseYear${sc.shoppingCartId}" value="${sc.useLife}">
		                            </td>
		                            <td class="td_amount">
		                            	<div class="item_amount" >
		                                	<a href="javascript:plusOrMinusYearNum('minus',1,'plusYear'+${sc.shoppingCartId},${sc.shoppingCartId})" class="J_Minus minus fl">-</a>
		                                    <input type="text" name="useLife" id="plusYear${sc.shoppingCartId}" 
		                                    onchange="javascript:yearNumValid(1,'plusYear'+${sc.shoppingCartId},${sc.shoppingCartId})" 
		                                    value="${sc.useLife}" class="text text_amount J_ItemAmount fl" data-max="500" data-now="2" autocomplete="off">
		                                    <a href="javascript:plusOrMinusYearNum('plus',1,'plusYear'+${sc.shoppingCartId},${sc.shoppingCartId})" class="J_Plus plus fl">+</a>
		                                </div>
		                            </td>
		                            <td class="td_amount">
		                            	<div class="item_amount">
		                                	<a href="javascript:plusOrMinusUserNum('minus','usersMin'+${sc.shoppingCartId},'plusUserNum'+${sc.shoppingCartId},${sc.shoppingCartId})" class="J_Minus minus fl">-</a>
		                                    <input type="text" name="userNum" id="plusUserNum${sc.shoppingCartId}" 
		                                    onchange="javascript:userNumValid(10,'plusUserNum'+${sc.shoppingCartId},${sc.shoppingCartId})" 
		                                    value="${sc.userNum}" class="text text_amount J_ItemAmount fl" data-max="500" data-now="2" autocomplete="off">
		                                    <a href="javascript:plusOrMinusUserNum('plus','usersMin'+${sc.shoppingCartId},'plusUserNum'+${sc.shoppingCartId},${sc.shoppingCartId})" class="J_Plus plus fl">+</a>
		                                </div>
		                            </td>
		                            <td class="price_line" id="proMealPrice${sc.shoppingCartId}"><fmt:formatNumber value="${sc.proMealPrice}" pattern="#0.00"/></td>
		                            <td class="offer" id="discount${sc.shoppingCartId}">
		                            	<c:if test="${userInfo.roleId == 'ROLE_AGENT'}">
		                            		<c:if test="${supplierInfo.isValid == 1}">
		                            			<c:if test="${sc.relationId == '0'}">
		                            				<fmt:formatNumber value="${sc.proMealPrice * (1 - supplierInfo.mealPrivilege) * (-1)} " pattern="#0.00"/>
		                            			</c:if>
		                            			<c:if test="${sc.relationId != '0'}">
		                            				<fmt:formatNumber value="${sc.proMealPrice * (1 - supplierInfo.proPrivilege) * (-1)} " pattern="#0.00"/>
		                            			</c:if>
		                            			
		                            		</c:if>
		                            		<c:if test="${supplierInfo.isValid != 1}">0.00</c:if>
		                            	</c:if>
		                            	<c:if test="${userInfo.roleId != 'ROLE_AGENT'}">0.00</c:if>
		                            </td>
		                            <td class="td_amount" id="proMealNum${sc.shoppingCartId}">${sc.proMealNum}</td>
		                            <!-- <div class="item_amount"> -->
		                                	<%-- <a href="javascript:plusOrMinusProMealNum('minus',1,'plusProMealNum'+${sc.shoppingCartId},${sc.shoppingCartId})" class="J_Minus minus fl">-</a> --%>
		                                    <%-- <input type="text" name="proMealNum" id="plusProMealNum${sc.shoppingCartId}" 
		                                    onchange="javascript:proMealNumValid(10,'plusProMealNum'+${sc.shoppingCartId},${sc.shoppingCartId})" 
		                                    value="${sc.proMealNum}" class="text text_amount J_ItemAmount fl" data-max="500" data-now="2" autocomplete="off"> --%>
		                                    <%-- <a href="javascript:plusOrMinusProMealNum('plus',1,'plusProMealNum'+${sc.shoppingCartId},${sc.shoppingCartId})" class="J_Plus plus fl"">+</a> --%>
		                                <!-- </div> -->
		                            <td>
		                            	<a href="javascript:deleteShoppingCart(${sc.shoppingCartId},${sc.userId})">删除</a>&nbsp;|&nbsp;
		                            	<a href="javascript:checkOrders(${sc.shoppingCartId})" class="submit_btn${shoppingCartId}">确认订单</a>
		                            </td>
		                            <div class="clear"></div>
		                            </tr>
	                   	  		</c:forEach>
	                   	  	</c:if>
                  		</tbody>
         		 	</table>
                        <div class="float_bar_wrapper">
                        	<div class="select_all J_SelectAll ml10 fl">
                            	<input type="checkbox" name="checkboxAll" class="checkboxAll" />
                                <label for="checkbox">全选</label>
                            </div>
                            <div class="operations fl ml20">
                            	<a href="javascript:deleteShoppingCarts()" class="mr20">删除选中产品</a>
                                <a href="/mall">继续添加产品</a>
                            </div>
                            <div class="float_bar_right fr">
                            	<span class="amount_sum mr20">共<font color="#008fb5"><b id="allnum">0</b></font>件产品</span>
                                <span class="price mr20">总计：<font color="#008fb5">￥<b id="allsum">0.00</b></font></span>
                                <!-- <span class="btn_area"><a href="javascript:checkOrders()" class="submit_btn">确认订单</a></span> -->
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
    			</div>
            </div>
            <!--购物车结束-->
      	</div>
    <!--会员中心中间部分-->
    <!---------------------------------footer------------------------------------>
    <jsp:include page="../common/footer.jsp"/>
  	<!---------------------------------footer结束------------------------------------>
</div>
</body>
</html>
